<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <title>修改个人信息</title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <script type="text/javascript" src="/statics/js/custom/base.js"></script>
</head>

<body >
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body ">
                    <form method="post" class="site-form">
                        <div class="mb-3 ">
                            <label class="form-label">头像</label>
                            <div class="form-controls">

                                <ul class="list-inline row lyear-uploads-pic mb-0">
                                    <li class="col-6 col-md-4 col-lg-2">
                                        <figure class="thumbnail">
                                            <img name="photoUri" src="/statics/images/no_image.gif">
                                            <figcaption>
                                                <input type="file" filter=".png,.jpg,.jpeg,.bmp,.gif"
                                                       class="fileInput" style="display: none;"
                                                       name="file"/>
                                                <input type="hidden" name="photoUri" class="fileresult">
                                                <a class="btn btn-round btn-square btn-primary picUpload"
                                                   href="#!">上传</a>
                                                <a class="btn btn-round btn-square btn-danger picDelete"
                                                   href="#!">移除</a>
                                            </figcaption>
                                        </figure>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label for="user_name"  class="form-label">用户名</label>
                            <input type="text" class="form-control" id="user_name" name="userName"
                                   disabled="disabled"/>
                        </div>
                        <div class="mb-3  mx_validator">
                            <label for="real_name" class="form-label">真实姓名</label><span class="required">* </span>
                            <input type="text" class="form-control mx_required"
                                   mx_required_msg="真实姓名不能为空" id="real_name" name="realName"
                                   placeholder="输入真实姓名"/>
                        </div>
                        <div class="mb-3  mx_validator">
                            <label for="mobile" class="form-label">手机号</label><span class="required">* </span>
                            <input type="text" class="form-control mx_required" id="mobile"
                                   mx_required_msg="手机号不能为空" name="mobile"
                                   placeholder="请输入正确的手机号"/>
                        </div>

                        <div class="mb-3 col-md-12  mx_validator">
                            <label class="form-label">性别</label><span class="required">* </span>
                            <div class="clearfix mx_required form-controls" mx_required_type="radio"
                                 mx_required_msg="请选择男女">
                                <div class="form-check custom-radio form-check-inline ">
                                    <input type="radio" name="gender" id="nan"
                                           class="form-check-input" value="1">
                                    <label class="form-check-label" for="nan">男</label>
                                </div>
                                <div class="form-check custom-radio form-check-inline">
                                    <input type="radio" name="gender" id="nv"
                                           class="form-check-input" value="2">
                                    <label class="form-check-label" for="nv">女</label>
                                </div>
                            </div>
                        </div>
                        <button type="button" class="btn btn-primary mx_validator_button" id="submit">保存
                        </button>
                    </form>

                </div>
            </div>
        </div>

    </div>
</div>


<script type="text/javascript">


    $(function () {
        //拉取数据
        Request.builder()
            .url(ADMIN_INFO)
            .callback(function (e) {
                Form.setValues($(".card-body"), e.data);
            }).get();

        //保存数据

        $("#submit").click(function () {
            Validator.builder()
                .dom($(".site-form"))
                .url(ADMIN_INFO_UPDATE)
                .submitCallback(function(e){
                    if (e.code === "00000") {
                        LayerUtil.successMsg(ERROR_MSG.SUCCESS)
                        var userInfo = e.userInfo;
                        if (userInfo !== undefined && userInfo !== null) {
                            User.refresh(userInfo)
                        }
                        setTimeout(function () {
                            $(".mx_validator_button").attr("disabled", false)
                        }, 1000)
                    } else {
                        $(".mx_validator_button").attr("disabled", false)
                        LayerUtil.failMsg(e.msg != null ? e.msg : ERROR_MSG.FAIL)
                    }
                }).do()
        });
    });

</script>
</body>
</html>
